﻿//125.验证回文串
class Solution {
public:
    bool isLetterorNmber(char ch)
    {
        if ((ch >= '0' && ch <= '9')
            || (ch >= 'a' && ch <= 'z'))
        {
            return true;
        }
        return false;
    }

    bool isPalindrome(string s) {
        for (auto& ch : s)
        {
            if (ch >= 'A' && ch <= 'Z')
            {
                ch += 32;
            }
        }

        int begin = 0, end = s.size() - 1;
        while (begin < end)
        {
            while (begin < end && !isLetterorNmber(s[begin]))
            {
                begin++;
            }
            while (begin < end && !isLetterorNmber(s[end]))
            {
                end--;
            }

            if (s[begin] == s[end])
            {
                begin++;
                end--;
            }
            else
            {
                return false;
            }
        }

        return true;
    }
};

//HJ1 字符串最后一个单词的长度
#include <iostream>
#include <string>
using namespace std;

int main() {
    string str;
    getline(cin, str);

    size_t ch = str.rfind(' ');
    size_t last = str.size();
    cout << last - ch - 1;
    return 0;
}